﻿Imports SACommon

Public Class MyApp
    Const DataFile As String = "Updates.sau"
    Const SetFile As String = "Startup.ini"
    Public ReadOnly Property DatabaseFile As String
        Get
            Return UpdateCore.FixFolderText(My.Application.Info.DirectoryPath) & DataFile
        End Get
    End Property
    Public ReadOnly Property SettingsFile As String
        Get
            Return UpdateCore.FixFolderText(My.Application.Info.DirectoryPath) & SetFile
        End Get
    End Property
    Public ReadOnly Property DataDirectory As String
        Get
            Return UpdateCore.FixFolderText(String.Format("{0}\Data\{1}", My.Application.Info.DirectoryPath, gUDApp.SelectedAppID))
        End Get
    End Property
    Public ReadOnly Property TempDirectory As String
        Get
            Return UpdateCore.FixFolderText(String.Format("{0}\Data\{1}\TMP\", My.Application.Info.DirectoryPath, gudapp.selectedappID))
        End Get
    End Property
    Public ReadOnly Property DataVersionDirectory As String
        Get
            Return UpdateCore.FixFolderText(String.Format("{0}\Data\{1}\{2}", My.Application.Info.DirectoryPath, gUDApp.SelectedAppID, gVersion.SelectedVersion.VersionNumber))
        End Get
    End Property
    Public ReadOnly Property ArchiveDataVersionDirectory As String
        Get
            Return UpdateCore.FixFolderText(String.Format("{0}\Data\{1}\{2}\Archive\", My.Application.Info.DirectoryPath, gUDApp.SelectedAppID, gVersion.SelectedVersion.VersionNumber))
        End Get
    End Property
    Public ReadOnly Property UpdateVersionFile As String
        Get
            Return DataDirectory & UpdateCore.VersionFile
        End Get
    End Property
    Public ReadOnly Property UpdateVersionFileListFile As String
        Get
            Return DataDirectory & FileListFilename
        End Get
    End Property
    Public ReadOnly Property UpdateVersionFileSettingsFile As String
        Get
            Return DataDirectory & SettingsFilename
        End Get
    End Property
    Public ReadOnly Property UpdateVersionFileNotesFile As String
        Get
            Return DataDirectory & NotesFilename
        End Get
    End Property
    Public ReadOnly Property FTPMainUpdateFolder As String
        Get
            Return UpdateCore.FixURLText(gUDApp.SelectedApp.FTPServerURL & UpdateCore.RepositoryFolder)
        End Get
    End Property
    Public ReadOnly Property FTPUpdateVersionFile As String
        Get
            Return String.Format("{0}/{1}", UpdateCore.FixURLText(gUDApp.SelectedApp.FTPServerURL & UpdateCore.RepositoryFolder), UpdateCore.VersionFile)
        End Get
    End Property
    Public ReadOnly Property FTPUpdateVersionFileListFile As String
        Get
            Return String.Format("{0}/{1}", UpdateCore.FixURLText(gUDApp.SelectedApp.FTPServerURL & UpdateCore.RepositoryFolder), FileListFilename)
        End Get
    End Property
    Public ReadOnly Property FTPUpdateVersionFileSettingsFile As String
        Get
            Return String.Format("{0}/{1}", UpdateCore.FixURLText(gUDApp.SelectedApp.FTPServerURL & UpdateCore.RepositoryFolder), SettingsFilename)
        End Get
    End Property
    Public ReadOnly Property FTPUpdateVersionFileNotesFile As String
        Get
            Return String.Format("{0}/{1}", UpdateCore.FixURLText(gUDApp.SelectedApp.FTPServerURL & UpdateCore.RepositoryFolder), NotesFilename)
        End Get
    End Property
    Public ReadOnly Property FTPFileUpdateFolder As String
        Get
            Return UpdateCore.FixURLText(String.Format("{0}{1}/UpdateFiles", gUDApp.SelectedApp.FTPServerURL, UpdateCore.RepositoryFolder))
        End Get
    End Property
    Property UpdateAvailable As Boolean
    Public Property FileListFilename As String
    Public Property SettingsFilename As String
    Public Property NotesFilename As String
    Sub SetAppVariables()
        UpdateCore.RepositoryServer = gUDApp.SelectedApp.RepositoryServerURL
        UpdateCore.RepositoryFolder = gUDApp.SelectedApp.RepositoryFolder
    End Sub
End Class
